package com.kfm.boot.proxy;

import org.junit.jupiter.api.Test;

public class FileServicePorxy {

    @Test
    public void proxy(){
        UserDao userDao = new UserDao();
//        BaseDao dao = new ProxyDemo(userDao);
//
//        dao.selectOne();

        // 通过 jdk 动态代理生成一个 代理对象

    }
}

class ProxyDemo implements BaseDao {

    private BaseDao dao;
    public ProxyDemo(BaseDao dao){
        this.dao = dao;
    }

    @Override
    public void selectOne() {
        System.out.println("start");
        dao.selectOne();
        System.out.println("end");
    }

    @Override
    public void selectAll() {
        dao.selectAll();
    }

    @Override
    public void insert() {

    }

    @Override
    public void update() {

    }

    @Override
    public void delete() {

    }
}
